package com.system.FinancialDepartment.dao;



import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import com.system.FinancialDepartment.entity.Performance;


@org.springframework.stereotype.Repository
public interface PerformanceRepository extends PagingAndSortingRepository<Performance,Long>,JpaSpecificationExecutor<Performance>{
	
	   	//1.通过解析方法名创建查询
	   	public Performance findById(Long id);  	



	   	@Modifying 
	   	@Query(value="update Performance pfm set pfm.empId = ?2,pfm.wage = ?3 where pfm.id = ?1") 
	   	public int updatePerformance(Long id,Long empId,Long wage);
	   	
	   	@Modifying 
	   	@Query(value="delete Performance pfm where pfm.id  in (:ids)") 
	   	public int deletePerformances(@Param("ids")Long[] ids);
	   	
	   	@Query(value="from Performance performance where performance.empId like ?1") 
	   	public Page<Performance> findAll(Long empId ,Pageable pageable);

	   }
